package combat.protocol.data;

import java.rmi.RemoteException;

import gnu.cajo.invoke.Remote;
import combat.protocol.interfaces.OrderInt;
import combat.protocol.types.OrderType;

public class Order implements OrderInt {	

	private static final long serialVersionUID = 1L;
	private int orderID;
	private Object target;
	private OrderType type;
	
	public Order(Object _target, OrderType _type){
		this.target = _target;
		this.type = _type;		
	}
	
	@Override 
	public int getOrderID() {
		return orderID;
	}

	@Override
	public void setOrderID(int _orderID) {
		orderID = _orderID;
	}

	@Override
	public Object getTarget() {
		return target;
	}

	@Override
	public Remote getTarget_Remote() {
		try {
			return new Remote(getTarget());
		} catch(RemoteException e) {
			System.out.println("Something went wrong @ getTarget_Remote()");
		}
		return null;
	}

	@Override
	public void setTarget(Object _target) {
		target = _target;		
	}

	@Override
	public OrderType getType() {
		return type;
	}

	@Override
	public void setType(OrderType _type) {
		type = _type;		
	}
}
